<HTML>
<HEAD>
<TITLE>[Chapter 21] ContainerEvent </TITLE>
<META NAME="author" CONTENT="John Zukowski">
<META NAME="date" CONTENT="Thu Jul 31 15:21:37 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java AWT">
<META NAME="title" CONTENT="Java AWT">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java AWT" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch21_08.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 21<br>java.awt.event Reference</FONT></B></TD>
<td width=172 align=right valign=top>&nbsp;</td>
<td width=172 align=right valign=top><A HREF="ch21_10.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<DIV CLASS=refnamediv>
<H1>ContainerEvent <img src="gifs/bstar.gif" alt="(New)" border=0></H1>

<H2>Name</H2>

ContainerEvent <img src="gifs/bstar.gif" alt="(New)" border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.47"></A></h2>
</DIV>


<p>
<img align=middle src="./figs/contai2.gif" alt="[Graphic: Figure from the text]" width=502 height=92 border=0>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.48">Description</A></h2>

<P CLASS=para>
Container events are fired off when a component is added to or removed 
from a container. The AWT automatically deals with adding components to 
containers; these events are provided only for notification. 

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.49">Class Definition</A></h2>

<DIV CLASS=screen>
<P>
<PRE>
public class java.awt.event.ContainerEvent
   extends java.awt.event.ComponentEvent {
  // Constants
  public final static int COMPONENT_ADDED;
  public final static int COMPONENT_REMOVED;
  public final static int CONTAINER_FIRST;
  public final static int CONTAINER_LAST;
  // Constructors
  public ContainerEvent (Component source, int id, Component child);
  // Instance Methods
  public Component getChild();
  public Container getContainer();
  public String paramString();
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.50">Constants</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.46">COMPONENT_ADDED</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.47">public final static int COMPONENT_ADDED</A></h4>

<P CLASS=para>
Event type ID indicating that a component was added to a container. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.47">CONTAINER_FIRST</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.48">public final static int CONTAINER_FIRST</A></h4>

<P CLASS=para>
Specifies the beginning range of container event ID values. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.48">CONTAINER_LAST</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.49">public final static int CONTAINER_LAST</A></h4>

<P CLASS=para>
Specifies the ending range of container event ID values. 

</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.49">COMPONENT_REMOVED</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.50">public final static int COMPONENT_REMOVED</A></h4>

<P CLASS=para>
Event type ID indicating that a component was removed from a container. 

</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.51">Constructors</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.50">ContainerEvent</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.51">public ContainerEvent (Component source, int id, Component child)</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Parameters<br>
<DD>

<P CLASS=para>
<P>
<DL CLASS=variablelist>
<DT CLASS=varlistentry><I CLASS=emphasis>source</I><br>
<DD>

<P CLASS=para>
The object that 
generated the event.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>id</I><br>
<DD>

<P CLASS=para>
The event type ID of 
the event.

<p>
<DT CLASS=varlistentry><I CLASS=emphasis>child</I><br>
<DD>

<P CLASS=para>
The component that 
was added or removed. </DL>
<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Constructs a <tt CLASS=literal>ContainerEvent</tt> 
with the given characteristics. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.52">Instance Methods</A></h2>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.51">getChild</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.52">public Component getChild()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The component that is being added or removed. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.52">getContainer</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.53">public Container getContainer()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
The container for this event. </DL>
</DIV>

</DIV>

<DIV CLASS=refsect2>
<h3 CLASS=refsect2><A CLASS="TITLE" NAME="ch21-REFSECT2-AUTOID.53">paramString</A></h3>

<DIV CLASS=refsect3>
<h4 CLASS=refsect3><A CLASS="TITLE" NAME="ch21-REFSECT3-AUTOID.54">public String paramString()</A></h4>

<DL CLASS=variablelist>
<DT CLASS=varlistentry>Returns<br>
<DD>

<P CLASS=para>
String with current settings of the <tt CLASS=literal>ContainerEvent</tt>. 

<p>
<DT CLASS=varlistentry>Overrides<br>
<DD>

<P CLASS=para>
<tt CLASS=literal>ComponentEvent</tt><tt CLASS=literal>.paramString()</tt> 

<p>
<DT CLASS=varlistentry>Description<br>
<DD>

<P CLASS=para>
Helper method for <tt CLASS=literal>toString()</tt> 
to generate string of current settings. </DL>
</DIV>

</DIV>

</DIV>

<DIV CLASS=refsect1>
<h2 CLASS=refsect1><A CLASS="TITLE" NAME="ch21-REFSECT1-AUTOID.53">See Also</A></h2>

<P CLASS=para>
<tt CLASS=literal>Component</tt>, <tt CLASS=literal>ComponentEvent</tt>, 
<tt CLASS=literal>Container</tt>, <tt CLASS=literal>ContainerAdapter</tt>, 
<tt CLASS=literal>ContainerListener</tt> 

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch21_08.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top>&nbsp;</td>
<td width=172 align=right valign=top><A HREF="ch21_10.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>ContainerAdapter <img src="gifs/bstar.gif" alt="(New)" border=0></td>
<td width=171 align=center valign=top><a href="index/idx_a.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>&nbsp;</td>
<td width=172 align=right valign=top>ContainerListener <img src="gifs/bstar.gif" alt="(New)" border=0></td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
